package com.lanou.quanttradedata.stock.job;

import com.lanou.quanttradedata.stock.service.StockService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

@Component
public class StockDailyInfoJob extends QuartzJobBean {
    @Autowired
    private StockService stockService;
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("更新当日A股日线行情数据....");
        stockService.saveStockDailyInfoFromNet();
        System.out.println("维护A股日线数据，保证数据库中最多保存7天日线数据");
        stockService.maintainStockDailyInfo();
    }
}
